let fs = require('fs');
let path = require('path');
// let mongodb = require('mongoose');
// let MongodbFun = require('../lib/mongodbFun');
// let config = require('../config');
// mongodb.connect(config.mongodbUrl);
// mongodb.connection.on('connected', function () {
//     console.log('Mongoose connection open to '+ config.mongodbUrl);
// });
// mongodb.connection.on('error',function (err) {
//     console.log('Mongoose connection error: ' + err);
// });
// mongodb.connection.on('disconnected', function () {
//     console.log('Mongoose connection disconnected');
// });
fs.readdirSync(__dirname).forEach(function (fileName) {
    if (fileName == 'index.js')
        return;
    let modelName = fileName.split('.js')[0];
    let modelObj = require(path.join(__dirname, fileName));
    if(modelObj.dbType == "mongodb"){
        // exports[modelName] = modelObj.model;
        // for(let funKey in modelObj.fnArr){
        //     exports[modelName][modelObj.fnArr[funKey]] = MongodbFun[modelObj.fnArr[funKey]];
        // }
    }else{
        exports[modelName] = modelObj.model;
    }

});


